package com.atguigu.product.feign;

import com.atguigu.product.dao.GZGCreateOrderPload;
import com.atguigu.product.dao.JZGCreateOrderBody;
import com.atguigu.product.dao.ProductStockRequest;
import com.atguigu.product.dao.ProductStockResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

@FeignClient(value = "abatour-api", url = "https://api.abatour.com")
public interface GZGCroductStockClient {

    /**
     * 查询产品库存
     * POST https://api.abatour.com/merchant/tkt/client/product/stock
     * 请求体: {"productId":211,"merchantId":172,"playDate":"2025-10-20"}
     */
    @PostMapping(value = "/merchant/tkt/client/product/stock",
                 consumes = MediaType.APPLICATION_JSON_VALUE)
    ProductStockResponse getProductStock(
        @RequestBody ProductStockRequest request,
        @RequestHeader("Authorization") String authorization
    );
    /**
     * 抢票远程调用
     *
     */
    @PostMapping(value = "/order/create/inner", consumes = "application/json")
    JZGCreateOrderBody createOrder(
            @RequestHeader("Authorization") String authorization,
            @RequestBody GZGCreateOrderPload gzgCreateOrderPload
    );
}